package us.mooresr.aircraftscheduling.client.events;

import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.EventHandler;
import us.mooresr.aircraftscheduling.shared.model.User;
import com.google.gwt.event.shared.HasHandlers;

public class UserDeletedEvent extends
		GwtEvent<UserDeletedEvent.UserDeletedHandler> {

	public static Type<UserDeletedHandler> TYPE = new Type<UserDeletedHandler>();
	private User user;

	public interface UserDeletedHandler extends EventHandler {
		public void onUserDeleted(UserDeletedEvent event);
	}

	public UserDeletedEvent(User user) {
		this.user = user;
	}

	public User getUser() {
		return user;
	}

	@Override
	protected void dispatch(UserDeletedHandler handler) {
		handler.onUserDeleted(this);
	}

	@Override
	public Type<UserDeletedHandler> getAssociatedType() {
		return TYPE;
	}

	public static Type<UserDeletedHandler> getType() {
		return TYPE;
	}

	public static void fire(HasHandlers source, User user) {
		source.fireEvent(new UserDeletedEvent(user));
	}
}
